<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use App\Models\Student;
use Faker\Generator as Faker;

$factory->define(Student::class, function (Faker $faker) {
    /**
     * ddd()函数是自定义的
     * 作用是生成学号
     *  public function ddd(){
     *        static $count = 2020000;
     *        $count++;
     *        return $count;
     *   }
     * 在  Faker\Generator
     */
    return [
        'student_code'=>$faker->ddd(),
        'password'=>bcrypt('111111'),
        'name'=>$faker->name,
        'email'=>$faker->email,
        'phone'=>$faker->phoneNumber,
        'sex'=>['未知','男生','女生'][rand(0,2)],
        'class_name'=>'2020届1班',
    ];
});
